/**
 * Coryright 2015-2020 www.eyaomall.cn
 * All rights reserved.
 * @author huwenqing
 * @date 2016年8月3日
 *
 */
package com.eyaomall.wxmanage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eyaomall.wxmanage.model.po.ArticleCategory;
import com.eyaomall.wxmanage.service.ArticleCategroyService;
import com.lycheeframework.core.cmp.api.http.GsnData;
import com.lycheeframework.core.cmp.api.http.GsnResponse;
import com.lycheeframework.core.cmp.kit.PageHTTPObject;

/**
 * 文章分类
 * @author Administrator
 *
 */
@Controller
@RequestMapping("article_catgory")
public class ArticleCatgoryController {
	
	@Autowired
	private ArticleCategroyService articleCategroyService;
	
	/**
	 * 分类页面
	 */
	@RequestMapping("index")
	public String indexPage(){
		return "articleCategroy/type";
	}
	
	/**
	 * 新建分类页面
	 */
	@RequestMapping("open_window")
	public String editor_group(){
		return "articleCategroy/newType";
	}
	
	/**
	 * 编辑页面
	 */
	@RequestMapping("editor_window")
	public String editor_page(Integer id,Map<String, Object> mode){
		mode.put("id", id);
		return "articleCategroy/editPage";
	}
	
	/**
	 * 分页数据
	 */
	@RequestMapping("pageData")
	public @ResponseBody GsnData pageData(ArticleCategory articleCategroy,PageHTTPObject object){
		return GsnResponse.toData(articleCategroyService.page(articleCategroy,object));
	}
	
	/**
	 * 删除分类
	 */
	@RequestMapping("del")
	public @ResponseBody GsnData delData(Integer id){
		return GsnResponse.toData(articleCategroyService.delData(id));
	}
	
	/**
	 * 保存分类
	 */
	@RequestMapping("saveData")
	public @ResponseBody int saveData(ArticleCategory articleCategroy){
		return articleCategroyService.saveData(articleCategroy);
	}
	
	/**
	 * 修改分类名
	 */
	@RequestMapping("edit")
	public @ResponseBody boolean editData(ArticleCategory articleCategroy){
		return articleCategroyService.editData(articleCategroy);
	}
	
	/**
	 * 加载数据
	 */
	@RequestMapping("load")
	public @ResponseBody GsnData loadData(ArticleCategory articleCategroy){
		return GsnResponse.toData(articleCategroyService.load(articleCategroy));
	}
}
